package com.songshuai.webapi.baseapi.enumerations;

public enum StudentTypeEnum {
    Potential(6006001, "潜在学员"),
    OnStudying(6006002, "在读学员"),
    History(6006003, "历史学员");
    private int code;
    private String msg;

    StudentTypeEnum(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public static int getCode(String define){
        try {
            return StudentTypeEnum.valueOf(define).code;
        } catch (IllegalArgumentException e) {
            return 0;
        }
    }

    public static String getMsg(String define){
        try {
            return StudentTypeEnum.valueOf(define).msg;
        } catch (IllegalArgumentException e) {
            return "";
        }
    }

    public static String getMsg(Integer code){
        if(code==null||code<=0)
            return "";
        for(StudentTypeEnum err : StudentTypeEnum.values()){
            if(err.code==code){
                return err.msg;
            }
        }
        return "";
    }

    public int getCode(){
        return code;
    }

    public String getMsg(){
        return msg;
    }
}
